# ------------------------------------------------------------------------------
# Replication Materials
# 
# title: Eliciting Beliefs as Distributions in Online Surveys
# journal: Political Analysis
# authors: Lucas Leemann, Richard Traunmüller, and Lukas Stoetzer
# date: August 2020
# ------------------------------------------------------------------------------




### R code Data cleaner

data <- read.csv("in/Prior_Elicitation_Nachtrag_Quantile.csv", sep=",", header=T)

dim(data)
data <- data[-c(1:2),] 

### Median Question
table(data$Q37)
data$Q37[data$Q37==""] <- NA
#data$Q37 <- droplevels(data$Q37)

table(data$Q39)
data$Q39[data$Q39==""] <- NA
#data$Q39 <- droplevels(data$Q39)

table(data$Q41)
data$Q41[data$Q41==""] <- NA
#data$Q41 <- droplevels(data$Q41)


### Screener Questions
table(data$Q135)
#data$Q135 <- droplevels(data$Q135)
data$screen1 <- ifelse(data$Q135=="Purple and yellow", 1, 0)

table(data$Q127)
#data$Q127 <- droplevels(data$Q127)
data$screen2 <- ifelse(data$Q127=="University of Zurich", 1, 0)


prop.table(table(data$screen1))
prop.table(table(data$screen2))